<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="./axios.js"></script>

    <script>
      //同时发起多个请求
      const provinces = axios({
        method: 'GET',
        url: 'http://ajax-api.itheima.net/api/province',
      })

      const news = axios({
        method: 'GET',
        url: 'http://ajax-api.itheima.net/api/news',
      })

      const login = axios({
        method: 'POST',
        url: 'http://ajax-api.itheima.net/api/login',
        data: {
          username: 'admin',
          password: '123456',
        },
      })

      //使用Promise.all发起多个请求
      Promise.all([provinces, news, login]).then((res) => console.log(res))
    </script>
  </body>
</html>
